toppage refactored