Adding input checking.