added format() and groups() functions, support int casting for array