Added Jake Zwart's wedderburn and layer density functions