replace each with reduce that is actually want
make test location agnostic
refactor logging to provide better API