more refactoring of the old hv client into a new one. Started to write unit tests as well