added exit() calls once the functions complete and added output. Completed for the time being