Refactors to use lib files for meat of program