Massive code cleanup!