Fixed API to be more object-oriented.