Initial implementation for #301