untested but it should work
updated notes