Added 401 handling, changed 501 symbol and fixed indentation/whitespace