Refactors out mutation, bad functional progamming practice.