Merged Alans and Bryans code.  Removed old code.