Implementing a better print_error routine