finally working as expected