Add function start and end functionalaty.