Improved code - Part 2