Work for #243
Work for #245 and #246