Some formatting & Maybe fixed a bug caused potential memory leak.