erlang: cleaned up run loop/state and created initial edoc