Significant code refactoring

Separated some of the code into their own scripts with some checks to
make sure each entity is actually within gameplay bounds