Reduce scope subject to try/catch block. Removed null pointer checks