more changes

removed a lot of unused junk, added in more comments and refactored,
fixed up some switches and renamed some stuff that annoyed me.