Add example with two layers; Fix bug in building final output array