Updated to support more options when calling API