clean the code + add comments