Revert "Reverting non working changes"

This reverts commit e5553ba7357aaae0e3635dc9b4736ef23450a3f5.