Added some comments and optimizations

Selectable number of pages and screen render size.