revise code structure