added exception handling/logging