Consolidate common code from ThePlayer variants

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>