Add performance note in the use of ifelse.
Remove some trailing whitespaces.