Refactored Sessions lib