Refactoring buttterfly.js. Player included