Code cleanup. Fixed some names and removed dead code.