Back propagation code re-visited and cleaned