Added try/catch logic