Added check for undefined result, removed dead code and unneeded comment...

...s