refactored cannon code into its own class.