Added user checks so program won't crash.