removed old code
removed use of undef value