add all tests fix bugs split code