code cleanup and check