[IMP] Improved the code