Complete rewriting (removed page context handler)