Moved init() and sessionCheck() in the dispatch function