rework api to use object instead of parameters, support useragent-style parses, add tests