missing brackets added, indentation updated