Update matrix, switch to pure c