Refactor projection code to Model