WIP, trying to tidy up.