Refactored the add action