refactor and improvement from WheatherGod and NellV revue