added better validations and delete functionality