refactor page handlers

I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself