better var names and comments, and mark-as-read works fine now