updated to reflect new api
cleaned a little