Adding onComplete

Also reformatted the design of the test cases