code cleanup - refactoring