Added collision detection, closes #22