improved player code