added some math and random