Revert "clean up redundant code"

This reverts commit d78b10a890b6c99078694029175ed3a0ea657fdf.