second refactor of the project