fleshing code out for the api