Enhance code and put gallery feature in a plugin