first version complete. Some output missing.