Wrote functions and comments