Added clear layer logic
Added clear layer logic