moved tests into this branch and solved a few small bugs