- refactored the code to improve legibility