graduation project -- erlang version