My own documented code, going through "learn you some erlang"