Updated functions with comments.