some cleanup and fixin