Passing directory parameter to the correct place