updated code for better readability