code cleanup (91KB to 50KB)