Replace most exceptions with logger.error

Let's try to handle these errors without exceptions
Fix a coding problem
Move hard coded settings to settings module
Whitespace fixes