Working reference implementation