This should probably be checking the type of value to ensure we are getting what we expect.