Some cleanup to make workable for real use.