refactor player, add UI support