code restructuring and gallery addition