working version of simulator