added changes from private repo: https://github.com/t-weber/misc/commit/98f2f575e156a29b8d74415fa1ca3b7989175225