Adding a test.
Rearranging the code.