New session module with sorting function