added user configurability for several settings, and better error handling