Put com port into config
Minor tidyups and refactoring