Passing all tests and fixed obscure bug