Updated hook functions, and code reviewed them.