refactor getPort code
begin integrating GM mode controls