Fixing 2d collisions and various other stuff.