code cleanup and stuff