Refactor status page code