improved calculation of use_grades
new simplified session_codes.py, tailored for pip2, would have to be generalized to other books