Reviewed version of #153