functions are completed and comments are added