very rough first pass to fix #14