general cleaning up and fixing

much fewer nasty methods, and implemented most of Andrew's advice.