code cleanup and rationalization