Some bugfixes to deal with missing values when the data is not completely paired. Exported some user-facing functions