Massive code cleanup. Partially complete. Should only have variable names to fix left.