clean up the logic of parse-struct