Refactor projection code to Model
Fixing PR issues