Added logic to handle required options