Logging changes; logs are now under the 'logs' directory. Also minor refactorings.