[IMP]Improved code as per new suggestion provided