Restructed to mimic something that's almost an MVC pattern.