general purpose erlang utils