Added data directory flexibility to Functions