Clean code and add comments