Extract shared code from default

rebase of #82