Cleanup and major refactor after some time away.