refactors code and improve specs - wip