more code cleanup and updates
more code cleanup and updates