Fix a possible crash & documentation comments

I've fixed a possible crash within the resetVisiblePages method. And put the comments into documentation format so it's accessible as comment documentation.