Added 400 error handling