Refactor the PatentAPI