removed debug statements
improved logging of exceptions