rearranged some code and test runner, moved tests to jest
reworked to use flow type annotations