Added docstring, added overwrite, added create directory if not exist