Logic moved from Controller to Model