Revert "Remove redundant code"

This reverts commit 28530085fb94e23b55cc6277dc6e15fdd3cc8a46.