improve option handling