add comments and functions