finaly the reg function i understand