Implement new json scheme. Clean up.