initial commit forked/rewriten from https://github.com/bmuller/twistar/