Fixed the issue with the logarithm. Some minor modifications.