Started to move logic into models