Significant cleanup of the frontend input code.