code cleanup and removed warnings