Updated testing to handle errors and print a cleaner output