adjusted formatting, fixed some bugs in main and created function stubs for the 2 main functions.