first draft of source code for simulations