Cleaned up code. Minor logging changes.