f the logic