code cleanup / refactoring