Reimplemented using different functions to get results and to print the
to stdout