added a boolean variable indicating wether to bounce or not