Added checks for scanf return value.