Split Main Code Into Different Files

Added header files.