Bubbling: a quick pseudo code