Added current branch.
Adopting a structure for each function (context,err)