added test methods and compartmentalized CAN code