Added explanations to function codes