Fixed minor bug and confirmed output seems to make sense.