A cleaner and slightly more efficient solution to #4987.
Authored by: jonas 2009-02-13
Parent: [r7867]
Child: [r7869]