Add clean up code on end