Adding comments, deleting unused functions.