Generic code cleanup