Please remove unnecessary codes. You might want to extract this function outside.