Use resolved_path instead of dirname and readlink directly