Adding some comments and functions.