added methods for addOnBarriers and removeOnBarriers