Adding version with bubble loop corrected.