More verbose logging. Remove obsolete imports. Unify exception style.