work in progress
now it works