improved exceptions with addition of status code as suggested in #15