better templating support
move process_pk around