added a new if-else block to format handler