cleaned up main class, commented, broke things up into methods for easier testing... which probably should have been written first