reworked api to use an object