Improving code because of tests