Updated to handle sub-folders