adding some layer handling