made the apis more type safe