first version of testing.  needs to be refactored
some fixes based on testing