replaced simulation with math