Updated formatting and slight logic change