Refactor code to make API easier to use. Note: Includes BREAKING changes