Erlang challenge refactored for actor state in closure approach.