streamlining the code a bit. Still more work to do.