Re-write to support multiple pages