Physics and changed edge detection

finished cleaning up physics and changed edge detection to work more
correctly and removed minor glitches.