Revert "Remove unnecessary code"

This reverts commit efc96a616096906888ad4bca4dfcc65e7bfac69f.
Remove unnecessary code v2