Added resource free code.