Final changes, error fixes, test cases.