improved code
erlang compile errors resolved