Introduced RmSession.

Most global variables are still there, but most parts of the code have access to
the session instance now. Next step: move global variables to RmSession.
Astyled.