format/ logic fixing