Some API refactor. I may have missed some.

Signed-off-by: William Lebel <lebelwilliam@gmail.com>
Merge pull request #478 from greatman/master

Some API refactoring. I may have missed some.