More concise f-b algorithm