Refactor project file
Update cli to call exit less often