More thorough recursion prevention; whitespace cleanup; consistency.