Started code cleanup and commenting