general logic improvements with handling file extensions