Cleanup; divide into several files.