clean up and removal of dead code