Refactor and rm cruft.