output directory passed as argument rather than static constant