Incorporated the modifications made by Henning Krause