Reordered Layout, worked in Mathlab