Logging, fixed tests, comments and minor fixes