Added some error handling. Fine tuned key detection. Added initial http parameter parsing