globalized and added try/catches