This reverts commit eff27c74bf8c74781786f3c3724347e12764018a. Reason for revert: Incorrect logic breaks Gallery