Change API, introduce structure array, and enhance tests