Adds most of the collision logic

Feels wonky, not sure it's behaving correctly.