Move some matrix code out of main loop