Completely rewritten and optimized Session() class