Start of code to deal with creating casts