updated functions to make more readable
updated functions to make more readable