attempt at an erlang version