support for -p, --print option now; comes with some code refactorisation