Restructured + Input from files

Restructured code into different files based on logical divisions, also
adding the ability to take inputs from files.