improve display of results and clean up Pascals code a lot