Added 'New Page' functionality, as well as handling multiple pages and keeping track of page dimensions.