Fixed syntax and re-ordered critical variables