improving code for getting file name without extension