Added various logging statements

Fixed minor bug