improved code