code cleanup and style