refact generate cell structure