finish api refactor; improvements