Fixed #11 by passing the session variable to the methods instead of trying to use a global variable.