Working better, still need to separate the logic