Refactor buildProject