shuffled some code around, improved spacing