Oops, looks like I forgot a space in the $calc function for getting the sub tier. Anyways, I didn't realize that there is no option for editing my original post, so I will just keep the updated script on GitHub here.