separate the function