reorganized code. Added unit tests structure