make some code cleanup improvements