Unit tests
Simplify complex method