Improve some options, refactor, fix warnings