Added in error handling for 400s. Added method to send HTTP header for 400 and 405 errors