refine the naming and code structure