Added data structure to avoid the reference passing around.