package refactoring and factory methods