refactoring code, although not sure of initialize method