code cleanup and DONE