Revert "removed unused code"

This reverts commit 2d17f56b11c6c117326a7c4cfe336afa36bbf607.