Cleanup and final version

This is the final version.