Added check on empty input