more code cleanup

some more refactoring. code coverage 70% now