Moved cleaner to end of function to ensure that there is no double init.