Bleeding edge version 25.09.2014. Refactoring and part #1 of bugfix for expired session handling