Re-write this in a clean way, make it user friendly:
```sh
#!/bin/bash

# This script creates a keystore and a truststore from a key, a certificate and a CA certificate

# Usage: ./package-jks.sh -k key.pem -c cert.pem -C ca.pem -a NAME_1 -p pass.txt [-t]

# Define variables for the options
key=""
cert=""
ca=""
NAME_1=""
passfile=""
truststore=false

# Define a usage function to show the available arguments
usage() {
	echo "Usage: ./package-jks.sh -k key.pem -c cert.pem -C ca.pem -a NAME_1 -p pass.txt [-t]"
	echo "The following arguments are available in standard flag format."
	echo "-k FILE (Required) The private key file to use for the keystore"
	echo "-c FILE (Required) The certificate file to use for the keystore"
	echo "-C FILE (Required) The CA certificate file to use for the keystore"
	echo "-a  (Required) An unique NAME_1 to use in the keystore"
	echo "-p FILE (Required) The password file to use for the keystore"
	echo "-t create a truststore"
}

# NAME_2 the arguments using getopts
while getopts "k:c:C:a:p:t" opt; do
	case "$opt" in
		k)
			key=$OPTARG
			;;
		c)
			cert=$OPTARG
			;;
		C)
			ca=$OPTARG
			;;
		a)
			NAME_1=$OPTARG
			;;
		p)
			passfile=$OPTARG
			;;
		t)
			truststore=true
			;;
		help)
			usage
			exit 0
			;;
		*)
			echo "$opt is not a recognized flag!"
			usage
			exit 1
			;;
	esac
done

# Check if all the required arguments are provided
if [ -z "$key" ] || [ -z "$cert" ] || [ -z "$ca" ] || [ -z "$NAME_1" ] || [ -z "$passfile" ]; then
	echo "Missing required arguments!"
	usage
	exit 1
fi

# Set error handling option
set -e

# Define some constants for the file names and paths
p12="$NAME_1.p12"
LCA="/ca/ldap.pem"

TKS="truststore.jks"
TKSH="truststore-https.jks"
KKS="keystore.jks"

# Read the password from the password file
pass=$(cat "$passfile")

# Create truststore if requested
if $truststore; then
	echo "Creating truststore"

	# Create truststore with LDAP cert
	ATKS=$(openssl x509 -in $CA -noout -issuer | sed "s/.*CN = \(.*\)/\1/" | tr " " - | tr '[:upper:]' '[:lower:]')
	keytool -import -noprompt -trustcacerts -NAME_1 "$ATKS" -file "$CA" -keystore "$TKS" -deststorepass "$TSP"
	LATKS=$(openssl x509 -in $LCA -noout -issuer | sed "s/.*CN = \(.*\)/\1/" | tr " " - | tr '[:upper:]' '[:lower:]')
	keytool -import -noprompt -trustcacerts -NAME_1 "$LATKS" -file "$LCA" -keystore "$TKS" -deststorepass "$TSP"

	# Create truststore https
	keytool -import -noprompt -trustcacerts -NAME_1 "$ATKS" -file "$CA" -keystore "$TKSH" -deststorepass "$TSP"
fi

# Create keystore
openssl pkcs12 -export -in $cert -in Provide two versions of response separated with exactly 6 asterisk symbols: ******.
user