Refactoring api options array, making setOptions generic