Applied more logging, minor bug fixes