Fixed some logic & format.