#10 fixed misprints + small refactoring