Implementing the global normaliation
Added the global residual computation