some code cleanup and standardization