Applied patch and file renames from Piotr Wygocki