first pass of working solution withe some cleanup