Cleaning self tests code.

Trivial, simple reorganisation. Will merge myself. It will make the next code review clearer hopefully.