rewrite all the code & restruct the struct