initial revision with ability to switch between the 2 implementations