one round of cleanup of the front end to be more flexible