Revert "removed unused code"

This reverts commit 1fa29f218512c6ab20b019c813bc027b0677ca9c.