Move location logic to model