remove empty() and Change conditions