Improved miner so it won't include invalid transactions