Moved stateful history processing to ex.c.
Removed prefixes from some static functions.