Refactored to check input length rather than try clause