improved option handling