add erlang....some refactoring