General code cleanup