saves logic refactored