Sasha/refactor

A bit of refactoring