refactored gallery into plugin