smarten up the AI a bit (slightly more readable too) and some whitespace changes