Added tidy_up functionality.