change directory path to function not static