rewrite modules in erlang