Summary
Replace the datahandle with a better mechanism which would:
- Avoid unnecessary reads/writes
- Reduce coding mistakes (i.e. by ensuring that only certain types of data can be stored/retrieved)
- Generally improve performance (datahandle has to be accessed in the RHS for switch detection)
Possible Approaches
- Global function
storage which stores the data as persistent variables and can be interacted with via certain commands (e.g. store x, load y, etc.)
- Replace datahandle with an instance of a handle class