Refactored code for better defaults, support for generic pages