Refactor and add new tests for static pages