Cleaning up after automatic refactor and removing some dead and deprecated code.