added validations to title and error handling