added support for optional head or depth file