working variant
tests are passing