Cleanups and consolidation of some variables, some more error handling on connections to ES