Added a few input checks.