layers optimization