Refactor tests and pages