Changed to use internal session instead of importing