updating tests, correcting several minor bugs