Added a bit of idiot-proofing.