Updated ensure_project to be more generic.