Incorporated cleanup suggestions from Patrik and Konrad.