refactored the background music code
Refactor