removed dirty hack as it didn't work. added a better implementation