Refactoring prior to moving to the serial communication