updated code for readability