before factorize the functions