refactoring play func from bin to lib