restruct code structure