#1 initial code from melampo-demo