refactor miner