Further simplify the code and remove some redundant code.