Page separation

Page generation is now refactored out of the main script and threading is enabled.