restyled code to be more consistent