fixed bug - filter for directories in reference files
modified style to be more consistent with ruby way