Unable to understand master-chef contract in pancake-swap

I am going through a master chef contract in pancake swap farm and I am unable to understand some points in that contract.
—>what does reward debt means in user info, Is it the rewards he need to get or it is the rewards he already harvested
—>what does the update pool function is for, what it was doing
—>what does updating the staking pool is for, why we are updating all the allocation points to the first pool
—>what is the dev address