Move options validation logic outside from work method.
Some minor modification