Fix minor bug and adjust formatting