Cleanup
Refactoring to extract the similar actions.