latest version with fixes we discussed a few days ago

blaaa meh