Move logic into controllers