Updated code to get data directories