Restructuring of program

Restructured program and fixed a bug that came up from the last commit.
Also added a new TODO file.