Fixed collision detection, refactored tasks