Rebase of #163