code refactoring (bubble)