Inserted BSD3 license text
Converting to Bash script with more elegant design