renamed method ensure_directory -> ensure_directory_exists
removed some duplication