api cleanup, ton of small fixes