full refactoring :)