Global Variables and reading from the serial, memory management

If the code is usable in multiple locations or is cluttering up another function then for sure use a separate function.