b pointer optimization version working