Remove redundant checks and validate input