added reference implementation (hive.m)