toggle layer functionality