getbestbound function