Updating checks and using gawk instead of awk.