optimize layer add/remove with layers control present