Added validations and fixed controller test