some help refactoring