Added magnet code
Split motor and brake control into its own file