refactored bubble