move bubble creation to a function, since it's a biggish chunk of code