Added more comments for some functions