Erlang optimizations