code cleanup and clarity