Revert "removed unused code"

This reverts commit 6a98f6f50d72dd5d5a1460e23cae476713f9d509.