Refactored code working correctly on trivial data. Work on using two output nodes instead of one.