more hacking and refactoring (mainly related to Action and Session)