adding functions code