added tests. ready to chedk with valgrind