code cleanup and indented