501 and 400 errors implemented