refactored but still getting memory issues in app tests