finished port, need to run tests