400 error handling added