reorganize and add new tests