added try/catch blocks to parser to catch unexpected or missing elements