added more intelligence to filename recognition