removed unnecessary recursive function