Added comments to the session filtering script. Fixed a bug.