refactor for style/conformance, remove unused routines