Fixed bug and tests passing