changed some stuff up in the update function so that it will run faster