Improved error handling ; Added header ; Improved security