optimize clear layers