refactor the whole project