Controlling the side effect of methods