fixed simulate script and updated clearCell function