refactored, substituted logging with exceptions