Updating makefile and restructuring code.

need this