code cleanup/refactoring