Removed need for dirname as parameter