Fixed toroidal world. A rather clumsy fix, but it works for now until I figure out why the modulus method wasn't working.
This method is somehow faster too... not sure what's up with that but I've got no complaints.