remove dead code, propose Erlang rewrite