Works better now, but some tests are still failing