refactored
more abstraction. lots of good stuff. see benchmark.