start of the function