standalone version of tlenns/misc