new gallery, code refactor & fixes