Shuffled the code around a bit.