further progress on code cleanup