Improved physics of collisions, fix bug with edges