Optimizing and tidying