Changed output format and improved testing function