Cannon code cleanup

Removed extraneous code, cleaned up distance formula.