added format helper and tests