code cleanup and prettify