more cleanup; basic functionality there; needs further refinement