remove unnecessary variable and array