improved code design