global variable deprecation

this connection code needs a complete refactor...