Refactor out old unused code