Modified Dr. Debray's bashscript further