Added logging, fixed typo