Add more tests; Fix realize implementation