code cleanup and some name changes