added base64 encoding option for session storage, rearrangement of code and tests added