fixed the short comings in code