Make some code more clean and ad comment