Done some refactoring. Added some comments. Removed unnecessary files.