Move logic into an isolated function

We want to keep logic separated as much as possible so that the code is easy to follow! Taking in input is wholly different then performing calculations in that input and they should therefore be separated.