One big mistake corrected. Using output as part of input while learning network