have simpler solution and it works