Cleanup and general fixes along with LGM commit.