added tests; added recursive directory creating if path doesnt exist