re-ordered a small piece of code