Added and updated comments for all functions