some refactoring and started with first algorithms