Implementing Matt's fixes.