Enable warnings and optimizations
Remove pointless instructions
Add missing pattern case
Handle BadRequest status codes
Cleanup imports

Qualify most imports, and remove superfluous ones