check layer clarified a bit and reorganize to allow for clean passing of layer names