Add page_key_filter callback, refactor tests