Fixed the logic more