Added file extension check.