Added modify action. Refactored save function.