Reworked collision detection to be more robust
Created input handling function to be called in update