added some comments for the functions