changed constructor to have format as a second parameter