Cleaned up player javascript