Make Set() functions more type safe