Tested thoroughly, no memory leaks