new version with extra tuple print function
improved and cleaned up version