almost there with the logic