Fixed B-search. Next-step: templating