#23 Added tests and refactored code in PageGenerator