change logic and tests so they both work together