full refactor code and classes