Refactored player Token javascript