merged Jim Rezn8d Lee's updates, and added some improvements