Migrated to using logging
Made the whole file be less hacky and consistent with itself
Fixed typo
Migrated to logging