Refactor following of joshWyatt & alexanderGugel