test almost finished, and a few cosmetic changes to code
joel's updates