code for deciding if a selection session is valid