Cleanup on a lot of the existing code.