Added extra helper method, trying to make program more modular to accommodate a GUI