code cleanup and consistency