unified check script with purge functionality and added some options