Added build in function path.extname

Added build in function path.extname so code will look a little simpler.