Now working, much faster, with tests!