using exists function to check if command exists in a cleaner way (instead of using which)