refactors mastermind a bit