refactored so that two types can beat each other