Using session, very ugly
Added sorting also to session