cleanup commented functions and add util doIfExists.