- Rename a bunch of variables to be more clear about their purpose
- Move some variables down into the function where they are needed, instead of being global (leaving cursnap & cursnaptime global to keep their declarations together)