Changed code to be more readable