Revert "Removed unused code - fix #335"

This reverts commit 5c781244e14d22fffac8e2bb038508ea2e275c40.
Removed actually unused code
Cleaning