fix gh-41 by removing duplication and cleaning up

Simple clean up of the duplication in the HostParser class.