adding all the references and simulation code