Initial code cleanup and updates