removed dir creation out of define