added back prop code, needs testing