move player functions in module
fix some bugs