refactoring code now uses one function to add or subtract