added many test routines - need to clean up code