add possibility to pass custom options
merge with master branch