Updated python binary writer to use the struct module. New optimized matrix not yet happy with changes