Refactoring options to named parameters and introducing the generate_url method.