Made more simple
Fixed if expression in a unified way