Added tests for FormattingService and fixed minor bug