added model validations
added controller functions