fix a host of bugs, better styling, properly pointed APIs