Started transitioning client code to algorithm