first conditional layer implementation