initial efforts on refactoring