Added type checking for set; Changed internal methods to use set and get