minor code cleanup and policing