refactor(matemat): refactor handling of serial stuff