Refactored shellscripts