refactored and handled bad request
refactored
refactored