Add functionality of main

Added functionality of main, including a functions source file to
handle various sub-processes.