Updated so text rendering works with reordering of code