optimize selectors and optionally load gallery ID from hash