more precise language and some code reordering