Added global constants, made function agnostic of input, updated commenting, general light refactor. Late night sut sunday commit, heading to bed. Will take a fresh look at this at work tomorrow.