for merge from GH
wip and unwip reimplemented in timl