Refine testing code, add more tests, fix failing tests

:+1: