Moving setup code to helper functions.
Cleaned up collision checking code.
Fixing bugs after the refactor.
Removed some duplicate code.