restructure player.js