Code clean-up and minor speed-up.