added validations, sorting not working yet