Edited algorithms and main file to handle input and output file handeling differently where main controls all input and output conventions.