session: code cleanup