Add player position filter and a bit of refactoring