Added match group id output variable.
Simplify time formatting functions