Some Refactoring + closing stmts and connections