Unified process_X() functions

Eliminates a bunch of duplicate code.