A reference implementation