all groups are parsed from file and dataset and attribute keys are
parsed. This was ugly.
added flush function and cleaned up some mess