added strategy factory, some refactoring