Code to detect bubble sizes.