Shared functionality for #30