Fixing the bash script and removing an used method