moved motor and port code to separate files