added more auxiliary calc code