Code cleanup, misc. bug fixes and support for default request options