refactoring some files
prepare test env
add some tests