Code cleanup: first revesion. Code almost cleaned up. Added makefile