add expanded bool, remove random while loop