added brake function