made some major changes incorporating simulation, etc