Fixed logging statements and minor code clean-up