setPlayer() function added plus various bugfixes