added else if and var