added basic tests + mini refactor