Commented/cleaned up code

Cleaned up the code, added comments. Removed the log(String) method completely.