moves code and add comments