switching to use the type safe api