added code for accel/decel