regularize the code