got the logic