Avoiding several bugs with respect to explicit zero initialization and cleaning up several routines