some insane erlang code