massive cleanup of gallery module