organize code structure and add basic tests