Added basic validations, error handling