added if else clause for niltodo