optimizing get dates query, and reworked options handling