Added better stencil support