tested and refactoring player