improved code formatting