An overhaul of most functions.