improved layer show / hide function