fixing session

Ecountering big problems with the mongodb sessions. Switching to a
global var declaration of the session instead of passing it as a
parameter everywhere. Should do the trick. Lots of refactoring and
rewriting to do though.