added simulator code