cleaning up somemore of the code as mkdir_p will just error out silently even if directory exists