General tidying up and removal of redundant, commented out, functions and the like.